/**
 * 积分商城-今日任务
 */
'use strict';
import React, {
    Component
} from 'react'
import {
    Link
} from 'react-router'

import Header from './Common/Header'
import LoadingBox from './Common/LoadingBox'
import {
    HttpService,
    dateFormat,
    Tips
} from '../Tools'

export default class orderDetail extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: {}
        }
    }
    componentWillMount() {
        this.getData()
    }

    getData(status) {
        HttpService.query({
            url: '/jf/order/getOrder',
            data: {
                token: sessionStorage.appToken,
                orderSerialNum: this.props.params.id
            },
            success: (res => {
                if (res.code == 10140 && res.data) {
                    this.setState({
                        data: res.data
                    })
                }
            })
        })
    }
    render() {
        const {
            deliverNo,
            address,
            orderStatus,
            orderCreateTime,
            linkPhone
        } = this.state.data
        const time = dateFormat(new Date(orderCreateTime), '-')
        return (
            <div className="task_today orderdetail">
                <Header title="订单详情" />
                <div className='itgmyorder'>
                    {deliverNo?
                    <div className='item'>
                        <p><span className='title'>订单编号：</span>6572837485938</p>
                        <p><span className='title'>快递单号：</span>{deliverNo}</p>
                        <p><span className='title'>下单时间：</span>{time}</p>
                        <p><span className='title'>物流公司：</span>顺丰快递</p>
                        <p><span className='title'>订单状态：</span><span className='c-blue'>{orderStatus}</span></p>
                        <p><span className='title'>商品名称：</span>从优秀教师到卓越教师</p>
                        <p><span className='title'>收货人：</span>张三</p>
                        <p><span className='title'>收货人电话：</span>{linkPhone}</p>
                        <p><span className='title'>收货人地址：</span>{address}</p>
                    </div>:
                    '无订单信息'}
                </div>
            </div>
        )
    }
}
